package com.scau.database.finalexam.DAO;

import com.scau.database.finalexam.beans.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserDao {

    @Select("select * from user")
    public List<User> selectUsers();

    @Select("select * from user where id=#{id}")
    public  User selectUser();

    @Update("UPDATE user set id=#{id},name=#{name} where password=#{password};")
    public void updateUser(User user);

    @Insert("insert into user(id, name, password) values(#{id},#{name},#{password});")
    public void insertUser(User user);

    @Delete("DELETE FROM user where id=#{id}")
    public void deleteUser(int id);
}
